﻿CREATE FUNCTION [dbo].[fn_FindAllNumbers](@inputstring [varchar](100))
RETURNS [bigint] WITH EXECUTE AS CALLER
AS 
begin
--Author : Apex Ltd
--Date: 2005.08.08
--declare variables
declare @count1 smallint
declare @len1 smallint
declare @word varchar(100)
declare @char1 char
--Assignment
set @word=''
set @count1=1
set @len1 = datalength(@inputstring)

	While @count1 <=@len1
	begin
	set @char1 =substring(@inputstring,@count1,1)
	if ascii(@char1) between 48 and 57 
	begin
	set @word=@word+substring(@inputstring,@count1,1)
	end
	set @count1=@count1+1
	end
return convert(bigint,@word)

end


